/**
 * 给定一个数组A，要求将数分组，使得同一组内的元素
 * 不存在对应二进制位相同的。
 * 实际上每组最多两个数，挨个看一下即可。
 */
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;

namespace IO{

char *__abc147, *__xyz258, __ma369[1000000];
#define __hv007() ((__abc147==__xyz258) && (__xyz258=(__abc147=__ma369)+fread(__ma369,1,100000,stdin),__abc147==__xyz258) ? EOF : *__abc147++)

int getUnsigned(){
	int sgn = 1;
	char ch = __hv007();
	while(ch < '0' || ch > '9') ch = __hv007();
	 
	int ret = (int)(ch-'0');
	while( '0' <= (ch=__hv007()) && ch <= '9' ) ret = ret * 10 + (int)(ch-'0');
	return ret;
}


char __pq981[1000000];
char const * const __rs721 = __pq981 + 1000000;
char * __qw752 = __pq981;

#define __ge(c) (__qw752 == __rs721 ? fwrite(__pq981, 1, 1000000, stdout), __qw752 = __pq981 + 1, *__pq981 = (c) : *__qw752++ = (c))

void putUnsignedEndl(int x){
    if(x == 0) return (void)(__ge('0'));

    char st[25];
	int top = 0;
	while(x){
		st[top++] = x % 10 + '0';
		x /= 10;
	} 
	while(top) __ge(st[--top]);
    __ge('\n');
	return;
}

void finish(){
	fwrite(__pq981, 1, __qw752 - __pq981, stdout);
}

}

int N;
vector<int> A;


int proc(){
    map<int, int> cnt;
    for(auto i : A) cnt[i] += 1;
    int ans = N;
    while(1){
        if(cnt.empty()) break;

        auto pp = *cnt.begin();
        cnt.erase(cnt.begin());

        int tmp = 0;
        for(int i=0;i<31;++i){
            if(pp.first & (1 << i)) ;
            else tmp |= 1 << i;
        }

        auto it = cnt.find(tmp);
        if(it != cnt.end()){
            ans -= min(it->second, pp.second);
            cnt.erase(it);
        }
    }
    return ans;
}

void work(){
    A.assign(N = IO::getUnsigned(), {});
    for(auto & i : A) i = IO::getUnsigned();
    IO::putUnsignedEndl(proc());
    return;
}



int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    // ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int nofkase = IO::getUnsigned();
    while(nofkase--) work();
    IO::finish();
    return 0;
}